package org.piera.diables;


import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;



public class diable extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
	Typeface tf;
	TextView tv;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        
        setContentView(R.layout.main);
        
        tf = Typeface.createFromAsset(getAssets(), "fonts/BrushScriptStd.otf");
        tv = (TextView) findViewById(R.id.textView1);
        tv.setTypeface(tf);
        
        //Set up click listeners for all the buttons
        Button historiaButton = (Button) findViewById(R.id.historia_button);
        historiaButton.setTypeface(tf);
        historiaButton.setOnClickListener(this);
        Button agendaButton = (Button) findViewById(R.id.agenda_button);
        agendaButton.setTypeface(tf);
        agendaButton.setOnClickListener(this);
        Button aboutButton = (Button) findViewById(R.id.sobre_button);
        aboutButton.setTypeface(tf);
        aboutButton.setOnClickListener(this);
        Button exitButton = (Button) findViewById(R.id.sortir_button);
        exitButton.setTypeface(tf);
        exitButton.setOnClickListener(this);       
    }

	
	public void onClick(View v) {		
		   
		switch (v.getId()) {		
			case R.id.historia_button:		
				//Toast.makeText(this, "Historia dels diables", Toast.LENGTH_LONG).show();
				Intent launchInfoFrom = new Intent(diable.this, About.class);
				startActivity(launchInfoFrom);
				break;
			case R.id.agenda_button:			 
				startActivity(new Intent(diable.this, ImageGallery.class));				
				break;
			case R.id.sortir_button:
				finish();
				break;
			case R.id.sobre_button:					
				try {
					Intent i = new Intent (Intent.ACTION_VIEW,Uri.parse("http://www.youtube.com/user/diablesdpiera"));
					startActivity (i);
				}
				catch(Exception e) {
					Toast.makeText(this, "Error", Toast.LENGTH_LONG).show();
				}				
				break;
			default:
	    		Toast toast = Toast.makeText(this, "Unknow Option", Toast.LENGTH_SHORT);
				toast.show();
		}
		
	}
	
}